﻿<%@ Page Title="" Language="C#" MasterPageFile="~/masterPage/admin/Supplier.master"
    AutoEventWireup="true" CodeFile="SupplierRetrieval.aspx.cs" Inherits="Trade_Resource_trade_retrieval" %>

<%@ MasterType VirtualPath="~/masterPage/admin/Supplier.master" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <telerik:RadDockLayout ID="RadDockLayout1" runat="server">
        <table>
            <tr>
                <td valign="top">
                    <telerik:RadDockZone ID="rdzFilterBuilder1" Visible="false" runat="server" Height="120px">
                        <telerik:RadDock ID="RadDock1" runat="server" Closed="false" Collapsed="false" DockHandle="TitleBar"
                            DefaultCommands="None" Title="检索条件设定" EnableDrag="false" Resizable="false">
                            <ContentTemplate>
                                <table>
                                    <colgroup>
                                        <col width="20" />
                                        <col width="200" />
                                        <col width="20" />
                                        <col width="300" />
                                        <col width="20" />
                                        <col width="300" />
                                        <col width="20" />
                                    </colgroup>
                                    <tr>
                                        <td>
                                            &nbsp;
                                        </td>
                                        <td>
                                            检索条件名称
                                        </td>
                                        <td>
                                            &nbsp;
                                        </td>
                                        <td>
                                            采购数量
                                        </td>
                                        <td>
                                            &nbsp;
                                        </td>
                                        <td>
                                            询盘发布时间
                                        </td>
                                        <td>
                                            &nbsp;
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            &nbsp;
                                        </td>
                                        <td>
                                            <telerik:RadTextBox ID="rtbFilterName" runat="server" MaxLength="30" EmptyMessage="请输入预保存的名称">
                                            </telerik:RadTextBox>
                                        </td>
                                        <td>
                                        </td>
                                        <td>
                                            <telerik:RadNumericTextBox ID="rntbMinQuantity" Width="100" runat="server" Type="Number"
                                                EmptyMessage="最小值">
                                            </telerik:RadNumericTextBox>
                                            <telerik:RadNumericTextBox ID="rntbMaxQuantity" runat="server" Type="Number" Label="< 采购数量 <"
                                                Width="160" EmptyMessage="最大值">
                                            </telerik:RadNumericTextBox>
                                        </td>
                                        <td>
                                            &nbsp;
                                        </td>
                                        <td>
                                            自
                                            <telerik:RadDatePicker ID="rdpFromSubmit" runat="server" Width="110px" EnableTyping="false"
                                                DateInput-ToolTip="请点击右侧日历选择日期" DatePopupButton-ToolTip="点击这里选择日期" SharedCalendarID="rcSharedSubmitDate" />
                                            至
                                            <telerik:RadDatePicker ID="rdpToSubmit" runat="server" Width="110px" EnableTyping="false"
                                                DateInput-ToolTip="请点击右侧日历选择日期" DatePopupButton-ToolTip="点击这里选择日期" SharedCalendarID="rcSharedSubmitDate" />
                                        </td>
                                        <td>
                                            &nbsp;
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            &nbsp;
                                        </td>
                                        <td>
                                            &nbsp;
                                        </td>
                                        <td>
                                            &nbsp;
                                        </td>
                                        <td>
                                            &nbsp;
                                        </td>
                                        <td>
                                            &nbsp;
                                        </td>
                                        <td>
                                            &nbsp;
                                        </td>
                                        <td>
                                            <telerik:RadCalendar ID="rcSharedSubmitDate" runat="server" CultureInfo="zh-CN" EnableMultiSelect="false">
                                            </telerik:RadCalendar>
                                            &nbsp;
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                        </td>
                                        <td colspan="3">
                                            <asp:RequiredFieldValidator ID="TextBoxRequiredFieldValidator" runat="server" Display="Dynamic"
                                                ControlToValidate="rtbFilterName" ErrorMessage="请为检索条件输入预保存的名称" ValidationGroup="FilterContentValidation" />
                                        </td>
                                        <td colspan="3" align="right">
                                            <asp:Button ID="btnExeFilter" runat="server" Text="立即检索" OnClick="btnExeFilter_Click" />
                                            <asp:Button ID="btnSaveFilter" runat="server" Text="保存检索条件" ValidationGroup="FilterContentValidation"
                                                OnClick="btnSaveFilter_Click" />
                                            <asp:Button ID="btnClearFilter" runat="server" Text="重新设定" OnClick="btnClearFilter_Click" />
                                            <asp:Button ID="btnReturn" runat="server" Text="返回" OnClick="btnReturn_Click" />
                                        </td>
                                    </tr>
                                </table>
                            </ContentTemplate>
                        </telerik:RadDock>
                    </telerik:RadDockZone>
                </td>
            </tr>
            <tr>
                <td valign="top" width="700">
                    <telerik:RadDockZone ID="rdzFilterBuilder2" runat="server" Orientation="Horizontal"
                        Visible="false">
                        <telerik:RadDock ID="RadDock2" runat="server" Width="300px" Closed="false" Collapsed="false"
                            DockHandle="TitleBar" DefaultCommands="None" Title="产品类型" EnableDrag="false"
                            Resizable="false">
                            <ContentTemplate>
                                <table>
                                    <tr>
                                        <td valign="top">
                                            <telerik:RadTreeView runat="Server" ID="rtvCategoryTree" CausesValidation="false"
                                                EnableDragAndDrop="false" CheckBoxes="true" DataSourceID="xdsWareCubes" DataTextField="title"
                                                DataValueField="key" OnDataBinding="rtvCategoryTree_DataBound">
                                                <DataBindings>
                                                    <telerik:RadTreeNodeBinding Expanded="false" CheckableField="check" />
                                                </DataBindings>
                                            </telerik:RadTreeView>
                                        </td>
                                    </tr>
                                </table>
                            </ContentTemplate>
                        </telerik:RadDock>
                        <telerik:RadDock ID="RadDock3" runat="server" Width="300px" Closed="false" Collapsed="false"
                            DockHandle="TitleBar" DefaultCommands="None" Title="加工工艺" EnableDrag="false"
                            Resizable="false">
                            <ContentTemplate>
                                <table>
                                    <tr>
                                        <td valign="top">
                                            <telerik:RadTreeView runat="Server" ID="rtvProcessTree" CausesValidation="false"
                                                EnableDragAndDrop="false" CheckBoxes="true" DataSourceID="xdsProcess" DataTextField="title"
                                                DataValueField="key">
                                                <DataBindings>
                                                    <telerik:RadTreeNodeBinding Expanded="false" CheckableField="check" />
                                                </DataBindings>
                                            </telerik:RadTreeView>
                                        </td>
                                    </tr>
                                </table>
                            </ContentTemplate>
                        </telerik:RadDock>
                        <telerik:RadDock ID="RadDock4" runat="server" Width="300px" Height="200px" Closed="false"
                            Collapsed="false" DockHandle="TitleBar" DefaultCommands="None" Title="采购商地址"
                            EnableDrag="false" Resizable="false">
                            <ContentTemplate>
                                <telerik:RadTreeView ID="rtvLocation" runat="server" CheckBoxes="true" AllowNodeEditing="false"
                                    CheckChildNodes="true" OnNodeExpand="rtvLocation_NodeExpand">
                                </telerik:RadTreeView>
                            </ContentTemplate>
                        </telerik:RadDock>
                    </telerik:RadDockZone>
                </td>
            </tr>
            <tr>
                <td valign="top" width="700">
                    <telerik:RadDockZone ID="rdzFilterViewer" runat="server">
                        <telerik:RadDock ID="rdockFilterMenu" runat="server" Title="我的询盘检索" Closed="false"
                            Collapsed="false" DockHandle="TitleBar" DefaultCommands="None" EnableDrag="false"
                            Resizable="false">
                            <ContentTemplate>
                                <telerik:RadComboBox ID="rcbFilters" runat="server" AllowCustomText="false" EmptyMessage="请选择检索条件"
                                    EnableTextSelection="false" ErrorMessage="!" Label="保存的检索条件">
                                </telerik:RadComboBox>
                                <asp:Label ID="lblErrorMessage" runat="server" Visible="false" ForeColor="#990000"></asp:Label>
                                <br />
                                <asp:Button ID="btnNewFilter" runat="server" Text="新建检索条件" OnClick="btnNewFilter_Click" />
                                <asp:Button ID="btnEditFilter" runat="server" Text="编辑当前检索条件" OnClick="btnEditFilter_Click" />
                                <asp:Button ID="btnDeleteFilter" runat="server" Text="删除当前检索条件" OnClick="btnDeleteFilter_Click" />
                                <br />
                                <telerik:RadComboBox ID="rcbCountry" runat="server" DataSourceID="xdsCountry" DataTextField="LocalName"
                                    DataValueField="Code" AllowCustomText="false" EmptyMessage="所有国家" EnableTextSelection="false"
                                    ErrorMessage="!" Label="快速筛选">
                                </telerik:RadComboBox>
                                <telerik:RadComboBox ID="rcbProvince" runat="server" AutoPostBack="true" OnSelectedIndexChanged="rcbProvince_SelectedIndexChanged">
                                </telerik:RadComboBox>
                                <telerik:RadComboBox ID="rcbCity" runat="server" OnSelectedIndexChanged="rcbCity_SelectedIndexChanged">
                                </telerik:RadComboBox>
                                <asp:Button ID="btnApplyFilter" runat="server" Text="筛选" OnClick="btnApplyFilter_Click" />
                                <asp:Button ID="btnRemoveFilter" runat="server" Text="清除" OnClick="btnRemoveFilter_Click" />
                                <br />
                            </ContentTemplate>
                        </telerik:RadDock>
                        <telerik:RadDock ID="rdockFilterViewer" runat="server" Title="检索结果" Closed="false"
                            Collapsed="false" DockHandle="TitleBar" DefaultCommands="None" EnableDrag="false"
                            Resizable="false">
                            <ContentTemplate>
                                <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
                                <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">
                                    <telerik:RadGrid ID="radGridMainlist" AllowPaging="True" AllowSorting="True" DataSourceID="sdsEventsList"
                                        AllowMultiRowSelection="true" runat="server" AutoGenerateColumns="False" OnItemCommand="radGridMainlist_ItemCommand">
                                        <PagerStyle FirstPageToolTip="首页" ShowPagerText="false" PagerTextFormat="{4}  当前{0}/{1}页, 条目({2}-{3})/{5}"
                                            NextPagesToolTip="下页" Mode="NextPrevAndNumeric" PageSizeLabelText="单页数目" PrevPageToolTip="上页"
                                            LastPageToolTip="末页" />
                                        <MasterTableView DataKeyNames="InquiryID, CompanyID" ShowHeadersWhenNoRecords="true"
                                            NoMasterRecordsText="无记录" CommandItemDisplay="Top">
                                            <CommandItemTemplate>
                                                <asp:LinkButton ID="lbtCreateEvent" runat="server" Text="添加至我的询盘" CommandName="CreateEvents"
                                                    OnClientClick="javascript:return confirm('要将选择项加入我的询盘吗?')" ForeColor="Red">添加至我的询盘</asp:LinkButton>
                                            </CommandItemTemplate>
                                            <Columns>
                                                <telerik:GridClientSelectColumn Reorderable="False" UniqueName="ClientSelectColumn">
                                                    <HeaderStyle Width="30px"></HeaderStyle>
                                                </telerik:GridClientSelectColumn>
                                                <telerik:GridImageColumn ImageAlign="AbsMiddle" AllowFiltering="false" AllowSorting="false"
                                                    HeaderText="零件图片" DataImageUrlFields="PartThumbnail" DataAlternateTextField="PartName">
                                                </telerik:GridImageColumn>
                                                <telerik:GridBoundColumn UniqueName="PartInfo" SortExpression="PartInfo" HeaderText="零件信息"
                                                    DataField="PartName">
                                                    <HeaderStyle Width="80px"></HeaderStyle>
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn UniqueName="Quantity" SortExpression="Quantity" HeaderText="采购数量1"
                                                    DataField="Quantity1">
                                                    <HeaderStyle Width="80px"></HeaderStyle>
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn UniqueName="Quantity" SortExpression="Quantity" HeaderText="采购数量2"
                                                    DataField="Quantity2">
                                                    <HeaderStyle Width="80px"></HeaderStyle>
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn UniqueName="Quantity" SortExpression="Quantity" HeaderText="采购数量3"
                                                    DataField="Quantity3">
                                                    <HeaderStyle Width="80px"></HeaderStyle>
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn UniqueName="Category" SortExpression="Category" HeaderText="工艺/零部件类别"
                                                    DataField="Category">
                                                    <HeaderStyle Width="100px"></HeaderStyle>
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn UniqueName="ExpireDate" SortExpression="ExpireDate" HeaderText="国家"
                                                    DataField="Country">
                                                    <HeaderStyle Width="125px"></HeaderStyle>
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn UniqueName="ExpireDate" SortExpression="ExpireDate" HeaderText="省份"
                                                    DataField="Province">
                                                    <HeaderStyle Width="125px"></HeaderStyle>
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn UniqueName="ExpireDate" SortExpression="ExpireDate" HeaderText="城市"
                                                    DataField="City">
                                                    <HeaderStyle Width="125px"></HeaderStyle>
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn UniqueName="ExpireDate" SortExpression="ExpireDate" HeaderText="有效期限"
                                                    DataField="ExpireDate" DataFormatString="{0:D}">
                                                    <HeaderStyle Width="125px"></HeaderStyle>
                                                </telerik:GridBoundColumn>
                                            </Columns>
                                        </MasterTableView>
                                        <ClientSettings>
                                            <Selecting AllowRowSelect="true" UseClientSelectColumnOnly="true" EnableDragToSelectRows="false" />
                                        </ClientSettings>
                                    </telerik:RadGrid>
                                </telerik:RadAjaxPanel>
                                <%--
                        <telerik:RadGrid ID="radGridMainlist" AllowPaging="True" AllowSorting="True" DataSourceID="sdsEventsList"
                        runat="server" AutoGenerateColumns="False">
                        <PagerStyle FirstPageToolTip="首页" ShowPagerText="false" PagerTextFormat="{4}  当前{0}/{1}页, 条目({2}-{3})/{5}" NextPagesToolTip="下页" Mode="NextPrevAndNumeric" PageSizeLabelText="单页数目" PrevPageToolTip="上页" LastPageToolTip="末页" />
                        <MasterTableView DataKeyNames="EventID"  ShowHeadersWhenNoRecords="true" NoMasterRecordsText="无记录">
                            <CommandItemSettings ExportToPdfText="Export to Pdf" />
                            <Columns>
                    <telerik:GridBoundColumn UniqueName="PartInfo" SortExpression="PartInfo" HeaderText="零件信息" DataField="PartInfo">
                        <HeaderStyle Width="80px"></HeaderStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn UniqueName="Quantity" SortExpression="Quantity" HeaderText="采购数量" DataField="Quantity">
                        <HeaderStyle Width="80px"></HeaderStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn UniqueName="Category" SortExpression="Category" HeaderText="工艺/零部件类别" DataField="Category">
                        <HeaderStyle Width="100px"></HeaderStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn UniqueName="ExpireDate" SortExpression="ExpireDate" HeaderText="国家" DataField="Country">
                        <HeaderStyle Width="125px"></HeaderStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn UniqueName="ExpireDate" SortExpression="ExpireDate" HeaderText="省份" DataField="Province">
                        <HeaderStyle Width="125px"></HeaderStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn UniqueName="ExpireDate" SortExpression="ExpireDate" HeaderText="城市" DataField="City">
                        <HeaderStyle Width="125px"></HeaderStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn UniqueName="ExpireDate" SortExpression="ExpireDate" HeaderText="有效期限" DataField="ExpireDate" DataFormatString="{0:D}">
                        <HeaderStyle Width="125px"></HeaderStyle>
                    </telerik:GridBoundColumn>
                                <telerik:GridTemplateColumn UniqueName="EventStatus" Groupable="False" HeaderText="信息状态">
                                    <HeaderStyle Width="75px"></HeaderStyle>
                                    <ItemStyle Height="35px"></ItemStyle>
                                    <ItemTemplate>
                                        <asp:Literal ID="ltlEventStatus" Text='<%# IIf((DataBinder.Eval(Container.DataItem, "EventStatus").StartsWith("0")), "未读", "已读") %>' runat="server"></asp:Literal>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                            </Columns>
                        </MasterTableView>
                        </telerik:RadGrid>--%>
                            </ContentTemplate>
                        </telerik:RadDock>
                    </telerik:RadDockZone>
                </td>
            </tr>
        </table>
    </telerik:RadDockLayout>
    <%--    <asp:SqlDataSource ID="sdsEventsList" runat="server" 
        ConnectionString="<%$ ConnectionStrings:XunPanConnectionString %>" 
        
        SelectCommand="SELECT * FROM [vw_XPInquiryEvent] WHERE ([VendorCompanyID] = @VendorCompanyID)">
        <SelectParameters>
            <asp:Parameter Name="VendorCompanyID" DbType="Guid" />
        </SelectParameters>
    </asp:SqlDataSource>--%>
    <asp:SqlDataSource ID="sdsEventsList" runat="server" ConnectionString="<%$ ConnectionStrings:XunPanConnectionString %>"
        SelectCommand="SELECT * FROM [vw_XPValidInquiry] I where not exists 
        (select * from  [XPInquiryEvent] E where I.[InquiryID]=E.[InquiryID] 
        and E.[VendorCompanyID]=@VendorCompanyID ) and SUBSTRING(I.[InquiryStatus], 3, 1) = '1' and I.[IsPublic]='1'"
        FilterExpression="{0}" >
        <FilterParameters>
            <asp:Parameter Name="Filter1" Type="String" />
        </FilterParameters>
        <SelectParameters>
            <asp:Parameter Name="VendorCompanyID" DbType="Guid" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:XmlDataSource ID="xdsCountry" runat="server" DataFile="~/App_Data/XML/Country_Simplied.xml">
    </asp:XmlDataSource>
    <asp:XmlDataSource ID="xdsProvinces" runat="server" DataFile="~/App_Data/XML/China_Provinces.xml">
    </asp:XmlDataSource>
    <asp:XmlDataSource ID="xdsCities" runat="server" DataFile="~/App_Data/XML/China_Cities.xml">
    </asp:XmlDataSource>
    <asp:XmlDataSource ID="xdsWareCubes" runat="server" DataFile="~/App_Data/XML/Warecube.xml">
    </asp:XmlDataSource>
    <asp:XmlDataSource ID="xdsProcess" runat="server" DataFile="~/App_Data/XML/MfgProcess.xml">
    </asp:XmlDataSource>
</asp:Content>
